<template>
  <div class="ll">
    <el-row style="width: 50%;margin: 0 auto;">
      <!--  <el-input placeholder="请输入客户序列" v-model="shop.shop1" maxlength="30" class="il" size="large" @change="getData"> -->
      <!--    <template slot="prepend">客户序列</template>-->
      <!--  </el-input>-->
      <el-input placeholder="请输入客户名称" v-model="shop.shop2" maxlength="30" class="il" size="large">
        <template slot="prepend">客户名称</template>
      </el-input>
      <el-input placeholder="请输入客户性别" v-model="shop.shop3" maxlength="30" class="il" size="large">
        <template slot="prepend"> 客户性别</template>
      </el-input>
      <el-input placeholder="请输入客户年龄" v-model="shop.shop4" maxlength="30" class="il" size="large"
                @change="getData">
        <template slot="prepend"> 客户年龄</template>
      </el-input>
      <el-input placeholder="请输入客户电话" v-model="shop.shop5" maxlength="30" class="il" size="large"
                @change="getData">
        <template slot="prepend"> 客户电话</template>
      </el-input>


      <!-- <el-col><el-input v-model="name" placeholder="请输入传感器类型"></el-input></el-col>
      <el-col><el-input v-model="id" placeholder="请输入传感器id"></el-input></el-col>
      <el-col style="margin-bottom: 20px"><el-input v-model="threshold" placeholder="请输入阈值（数值）"></el-input></el-col> -->
      <el-button type="success" round @click="sendData">添加</el-button>
    </el-row>
  </div>
</template>

<script>
import axios from "axios";

export default {
  name: "",
  data() {
    return {
      shop: {
        shop1: '',
        shop2: '',
        shop3: '',
        shop4: '',
        shop5: '',
        shop6: '',
        shop7: '',
        shop8: ''
      },
      name: '',
      id: '',
      threshold: '',
    }
  },
  methods: {

    sendData: function () {
      axios({
        url: '/api/customer/Insertcustomer',
        method: 'post',
        headers: {

          'Content-Type': 'application/x-www-form-urlencoded'//普通表单提交的Content-Type
        },
        transformRequest: [data => {

          let formData = new FormData()
          // formData.append('customerid',this.shop.shop1);
          formData.append('customername', this.shop.shop2);
          formData.append('customergender', this.shop.shop3);
          formData.append('customeryear', this.shop.shop4);
          formData.append('customerphoto', this.shop.shop5);

          return formData
        }],
      }).then(res => {
        console.log(res)
        if (res.data === 1) {
          this.$message.success("添加成功")
        } else {
          this.$message.error("添加失败")
        }
      }).catch(err => {
        this.$message.error("添加失败")
        console.log(err)
      })


    }
  },
}
</script>

<style scoped>
.ll {

  background: -webkit-repeating-radial-gradient(rgb(217, 255, 0), yellow 10%, green 15%); /* Safari 5.1 - 6.0 */
  background: -o-repeating-radial-gradient(rgb(0, 255, 170), rgb(255, 0, 0) 10%, rgb(93, 234, 93) 15%); /* Opera 11.6 - 12.0 */
  background: -moz-repeating-radial-gradient(rgb(0, 213, 255), yellow 10%, rgb(0, 98, 128) 15%); /* Firefox 3.6 - 15 */
  background: repeating-radial-gradient(rgb(89, 0, 255), rgb(0, 68, 255) 10%, rgb(162, 64, 243) 15%); /* 标准的语法（必须放在最后） */
  margin-top: 10%;
  margin-left: 25%;

  width: 50%;
  height: 50%;
  transition: 1s linear 1s;
  border: 10px solid #1445b0;
  border-radius: 15px 15px 15px 15px;
  background-color: #1445b0;
  box-shadow: 0px 0px 10px #05f0f0;

}
</style>
